package com.cms.server.resolver.plugins;

import com.efounder.builder.base.data.EFDataSet;
import com.efounder.builder.base.data.EFRowSet;
import com.efounder.builder.meta.domodel.SYS_OBJCOLS;
import com.efounder.eai.data.JParamObject;
import com.efounder.form.EFFormDataModel;
import com.efounder.form.io.FormDataResolverAdapter;
import com.efounder.form.server.resolver.util.BizFormUtil;
import com.efounder.form.server.resolver.util.SYS_MDL_VAL;
import com.efounder.sql.JStatement;
import com.metadata.bizmodel.SYS_MODEL;

public class CMSUpdateDJZT extends FormDataResolverAdapter {

	//初始化FormDataModel
	public void prepareSaveForm(JStatement stmt, EFFormDataModel formModel, JParamObject PO) throws Exception {
		EFDataSet                    billDataSet = formModel.getBillDataSet();
		EFRowSet                      headRowSet = null;
		String                            strSql = "";
		String                            F_GUID = billDataSet.getRowSet(0).getString(PO.GetValueByParamName(SYS_MODEL._BILL_GUID_COL_, SYS_MDL_VAL.BILL_GUID), "");
		java.util.Date                  currTime = new java.util.Date();
		
		for(int i = 0; i < billDataSet.getRowCount(); i++) {
			headRowSet = billDataSet.getRowSet(i);
			strSql = " update " + billDataSet.getTableName() + " set F_CHDATE = '" + currTime.getTime() + "' , F_DJZT = '" 
			       + headRowSet.getString("F_DJZT", "") + "' where F_GUID = '" + F_GUID + "'";
			stmt.execute(strSql);
		}
	}
}
